//引入mysql模块
const mysql = require('mysql');
//通过mysql创建一个连接
var connection = mysql.createConnection({
    //连接电脑ip地址
    host: 'localhost',
    //账号
    user: 'root',
    //密码
    password: '123456',
    //mysql的端口号
    port: '3306',
    //连接mysql的库名
    database: 'book'
});
connection.connect();
var sql = 'select * from books where name = ? and price = ?';
var sqlParam = ['H5', '8.8']
    //查
connection.query(sql, function(err, result) {
    if (err) {
        console.log('[SELECT ERROR] - ', err.message);
        return;
    }
    console.log('--------------------------SELECT----------------------------');
    console.log(result);
    console.log('------------------------------------------------------------\n\n');
});
connection.end();